using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;

public class processSinal
{
    private sinalData cmd;
    public processSinal(sinalData cm)
    {
        cmd=cm;
    }
    public int sendText(string cm)
    {
        return 0;
    }

    #region client message to server
    //LG:+{group code}+{name of group}: group code: 1, 2, 3, 4, 0: for control server; name of group: name asigned
    public int login(string computer, string name, string IP, string port)
    {
        string fulText;
        fulText = "LG" + computer + name + sendCommand.separator + IP + sendCommand.separator + port + sendCommand.endCommand;
        return sendText(fulText);
    }
    //SS: code: stage to show
    public int showStage(string computer, string code, string name)
    {
        string fulText;
        fulText = "SS" + computer + code + name + sendCommand.endCommand;
        return sendText(fulText);
    }
    //ES: end last showed form
    public int endShow(string computer)
    {
        string fulText;
        fulText = "SS" + computer + sendCommand.endCommand;
        return sendText(fulText);

    }
    //QL: show the question list
    public int questionList(string computer)
    {
        string fulText;
        fulText = "QL" + computer + sendCommand.endCommand;
        return sendText(fulText);
    }
    //SQ: show the question, for client and control
    public int showQuestion(string computer, string code)
    {
        string fulText;
        fulText = "SQ" + computer + code + sendCommand.endCommand;
        return sendText(fulText);
    }
    //MA: mark for the question to group by mark
    public int markAnswer(string computer, string group, string mark)
    {
        string fulText;
        fulText = "MA" + computer + group + mark + sendCommand.endCommand;
        return sendText(fulText);
    }
    //AC: allow continue to answer
    public int allowContinue(string computer)
    {
        string fulText;
        fulText = "AC" + computer + sendCommand.endCommand;
        return sendText(fulText);
    }
    //SM: show mark list of all canditates
    public int showMarklist(string computer)
    {
        string fulText;
        fulText = "SM" + computer + sendCommand.endCommand;
        return sendText(fulText);
    }
    //AA: ask for answer,
    public int AskForAnswer(string computer)
    {
        string fulText;
        fulText = "AA" + computer + sendCommand.endCommand;
        return sendText(fulText);
    }
    //AA: ask for answer,
    public int emergencyAnswer(string computer)
    {
        string fulText;
        fulText = "EA" + computer + sendCommand.endCommand;
        return sendText(fulText);
    }
    //AQ: answer for the question
    public int answerQuestion(string computer, string code)
    {
        string fulText;
        fulText = "AQ" + computer + code + sendCommand.endCommand;
        return sendText(fulText);
    }
    //SL: Send login reply again, in case raising error
    public int sendLoginReply(string computer)
    {
        string fulText;
        fulText = "SL" + computer + sendCommand.endCommand;
        return sendText(fulText);
    }
    //DQ: Disable question in case raising error
    public int disableQuestion(string computer, string code)
    {
        string fulText;
        fulText = "DQ" + computer + code + sendCommand.endCommand;
        return sendText(fulText);
    }
    //AF: Answer full text question
    public int answerFulltext(string computer, string code)
    {
        string fulText;
        fulText = "AF" + computer + code + sendCommand.endCommand;
        return sendText(fulText);
    }

    #endregion
    #region server send to client
    //LR code: number of stage, info: {number question of stage 1},{number question of stage 2}, ...
    public int loginReply(string computer, string code, string info)
    {
        string fulText;
        fulText = "LR" + computer + code + info + sendCommand.endCommand;
        return sendText(fulText);
    }
    //QC question content, to send question content to client and require to show. code is number of answer
    //code(3): second to count down, Q, A1, A2, A3, A4
    public int questionContent(string computer, string code, string Q, params string[] A)
    {
        string fulText;
        int i;
        fulText = "QC" + computer + code + Q;
        for (i = 0; i < A.Length; i++)
        {
            fulText += sendCommand.separator + A[i];
        }
        fulText += sendCommand.endCommand;
        return sendText(fulText);
    }
    //AL: allow answer
    public int allowAnswer(string computer)
    {
        string fulText;
        fulText = "AL" + computer + sendCommand.endCommand;
        return sendText(fulText);
    }
    //QC question content, to send question content to client and require to show. code is number of answer
    //code(3): second to count down, Q, A1, A2, A3, A4

    #endregion
}
